<template>
  <div :class="{'hidden':!selfShow}" id="bg">
    <div id="mg"
         style="width: 500px;padding-bottom: 4px;margin: 20% auto;background:#F3F4F6 ;border-radius: 10px;padding-top: 55px">
      <div class="main">
        <span style="letter-spacing: 2px;">是否搜索关于{{mxrBrandName}}的全部资源</span>
        <div class="tap-search">
          <button @click="close" class="btn6">取消</button>
          <button class="btn6" @click="searchMxr">确定</button>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
  import bus from '../../assets/eventBus'
  import ajax from '../../common/ajax'
  import api from '../../common/api'

  let pressId
  let userId

  export default {
    name: "SearchSlot",
    data() {
      return {
        selfShow: false,
        mxrBrandName: ''
      }
    },
    mounted() {
      /**
       * 打开确认搜索弹窗
       */
      let that = this
      bus.$on('showMxr', function (i) {
        that.mxrBrandName = i
        that.selfShow = true
      })
    },
    methods: {
      /**
       * 关闭确认弹窗
       */
      close() {
        this.selfShow = false
      },

      /**
       * 搜索梦想人资源
       */
      searchMxr() {
        let userId = this.$route.query.userId
        let culture = this.$route.query.culture
        let pressId = this.$route.query.pressId
        let belong = this.$route.query.belong
        this.$router.push({
          path: '/search',
          query: {
            pId: -1,
            userId: userId,
            culture: culture,
            pressId: pressId,
            brandName: this.mxrBrandName,
            belong: belong,
            import: false
          }
        })
      }
    }
  }
</script>

<style scoped>

  .hidden {
    display: none;
  }

  #bg {
    position: fixed;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.70);
    top: 0;
    z-index: 999;
    overflow-y: auto;
  }

  ::-webkit-scrollbar {
    width: 2px;
  }

  .btn6 {
    width: 120px;
    height: 30px;
    border: 1px solid black;
    background: white;
    border-radius: 8px;
  }

  .btn6:hover {
    cursor: pointer;
  }

  .main {
    text-align: center;
  }

  .tap-search {
    width: 300px;
    display: flex;
    margin: 55px auto;
    justify-content: space-between;
  }
</style>
